/**
 * Created by zhangqingxi on 2017-03-31.
 */


/**
 * 加载表格
 *
 */
function  loadDataList() {

    $('#dataList').datagrid({
        url:modelPath+'findStockByParam.shtml',
        queryParams:{
            sort:'d.addTime',
            order:'desc'
        },
        // idField:'id',
        fitColumns:true,
        pagination:true,
        rownumbers:true,
        singleSelect:true,
        sortOrder:true,
        striped:true,
        fit:true,
        columns:[[
            {field:'id',width:10,checkbox:true},

            {field:'emergencySuppliesName',title:'物资名称',width:10},
            {field:'stockState',title:'出\入库',width:10,formatter:function (value,row,index) {
                if(value===0){
                    return '入库';
                }else if(value===1){
                    return '出库';
                }
            }},
            {field:'number',title:'出\入库数量',width:10},
            {field:'userName',title:'领用人',width:10},
            {field:'addUserName',title:'登记人',width:10},
            {field:'addDeptName',title:'登记部门',width:10},
            {field:'d.addTime',title:'登记时间',width:10,sortable:true,formatter:function (value,row,index) {
                return row.addTime;
            }}
        ]],
        toolbar: '#toolbar'

    });


}

$(function () {
    loadDataList();
    //高级查询
    initAdvancedSearch();

    //查询按钮事件
    initSearchClick();

    //重置参数
    initResetClick();
});
